using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

namespace GauntletFramework
{
    public static class RenderTargetManager
    {
        static bool RenderTargetOn = false;
        static RenderTargetBinding[] RenderList;

        public static void SetRenderTarget(RenderTarget2D Target)
        {
            if (RenderTargetOn)
                return;

            RenderTargetOn = true;
            
            RenderList = StaticGame.GraphicsDevice.GetRenderTargets();
            StaticGame.GraphicsDevice.SetRenderTarget(Target);
            StaticGame.GraphicsDevice.Clear(new Color(0.5f, 0, 0, 0));
        }

        public static void UnSetRenderTarget()
        {
            if (!RenderTargetOn)
                return;

            RenderTargetOn = false;
            StaticGame.GraphicsDevice.SetRenderTargets(RenderList);
        }
    }
}